<table class="chart" style="margin-bottom:15px;">
    <tr>
        <th class="tc" width="5%"><input type="checkbox" name="selectAll" onclick="checkAll()"/></th>
        
        <th width="12%"><eq name="type" value="2">收件人<else />发件人</eq></th>
        <th width="65%">消息</th>
        <th width="18%">时间</th>
    </tr>
 <volist name="letterdata" id="vo">
    <tr>
        <td class="tc"><input type="checkbox" name="key" value="{$vo.id}"/></td>
        <td><eq name="type" value="2">{$vo.receptionname}<else />{$vo.sendname}</eq></td>
        <td>{$vo.message}</td>
        <td>{$vo.addtime|date='Y-m-d H:i:s',###}</td>
    </tr>
 </volist>
</table>


<div><a href="javascript:void(0)" onclick="deleteSelect(0)">删除选定项</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="javascript:send_message()">发送站内信</a></div>




<!-- .pages -->
<div class="pages cb clearfix"></div>
<!-- .pages end -->

<script type="text/javascript">
    $(".message").hover(
        function(){
            $(this).addClass("currentMessage");
        },
        function(){
            $(this).removeClass("currentMessage");
        }
    );
    
    $(".message .chart").click(function(){
        if($(this).hasClass("unread"))
        {
            $(this).removeClass("unread");
        }
        $(this).siblings(".messageBox").toggle();
    });
    function readstatus(id,mtype){
        //alert('/Member/readstatus/id/'+id+'/type/'+mtype);
        $.post('/Member/readstatus/id/'+id+'/type/'+mtype);
    }
    function checkAll(){
        $('input[type="checkbox"]').attr('checked',$('input[name="selectAll"]').attr('checked'));
    }
    function deleteSelect(mtype){
        var allVal='';
        $('input[name="key"]').each(function(i){
            if(this.checked){
                if(allVal==''){
                    allVal = this.value;
                }else{
                    allVal = allVal + ','+this.value;
                }
            }
        });
        if(allVal==''){
            alert('请选择后再操作!');
            return;
        }
        //alert('/Member/deleteselect/id/'+allVal+'/type/'+mtype);
        $.post(APP+'/Member/deleteselect/id/'+allVal,'',function(data,success){
           if(success=="success"){
                if(data=='1'){
                    mbsimajax(APP+'/Member/ajax_message/type/'+mtype+'/','ajax_list');
                }
           }
        });
    }
    function sendreply(id,toid,subject){
        var cDiv = '#msg_'+id;
        var cContent = '#commentContent_'+id;
        var rpContent = $(cContent).attr("value");
        //alert(rpContent);
        //return;
        $.post('/Member/sendreply',{
            "toid":toid,
            "subject": subject,
            "content": rpContent
            },
            function(data,success){
           if(success=="success"){
                if(data=='1'){
                    $(cDiv).html(rpContent);
                }else{
                    alert('回复未成功,请再试一次!');
                }
           }
            });
    }
</script>